package com.zmn.oms.dubbo.impl.zmn.pricefeedback;

import com.alibaba.fastjson.JSON;
import com.zmn.common.dto2.ResponseDTO;
import com.zmn.oms.common.dio.pricefeedback.PriceFeedbackDIO;
import com.zmn.oms.common.exception.OmsBaseException;
import com.zmn.oms.dubbo.interfaces.zmn.pricefeedback.PriceFeedbackModifyRemoteService;
import com.zmn.oms.dubbo.utils.DubboConsts;
import com.zmn.oms.zmn.business.interfaces.pricefeedback.PriceFeedbackBService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;

/**
 * 类描述: 价格反馈修改远程服务
 *
 * @author weilai
 * @since 2022/9/7  14:11
 */
@DubboService(version = DubboConsts.INTERFACE_VERSION, validation = "true")
@Slf4j
public class PriceFeedbackModifyRemoteServiceImpl implements PriceFeedbackModifyRemoteService {

    @Resource
    private PriceFeedbackBService priceFeedbackBService;
    @Override
    public ResponseDTO addPriceFeedback(PriceFeedbackDIO priceFeedbackDIO) {
        log.info("录入价格反馈#addPriceFeedback，入参:{}", JSON.toJSONString(priceFeedbackDIO));
        try {
            priceFeedbackBService.addPriceFeedback(priceFeedbackDIO);
            return ResponseDTO.success();
        }catch (OmsBaseException e){
            log.error("录入价格反馈业务异常:{}",e.getMessage());
            return ResponseDTO.fail(e.getMessage());
        }catch (Exception e){
            log.error("录入价格反馈异常:{}",e);
            return ResponseDTO.fail("录入价格反馈异常");
        }

    }
}
